package com.ourhours.message.exception;

import com.ourhours.message.enums.ApiResponseCode;

/**
 * Description:MessageException.
 *
 * @author chi.chen
 * @version V1.0
 * @since 2018/3/29
 */
public class MessageException extends RuntimeException{
    private static final long serialVersionUID = 3512771538525911543L;

    private String code;
    private String msg;
    private Throwable e;


    public MessageException(String msg) {
        super(msg);
        this.code = ApiResponseCode.ERROR.getCode();
        this.msg = msg;
    }

    public MessageException(ApiResponseCode errEnum, String msg) {
        super(msg);
        this.code = errEnum.getCode();
        this.msg = msg;
    }

    public MessageException(String msg, Throwable e) {
        super(msg, e);
        this.code = ApiResponseCode.ERROR.getCode();
        this.msg = msg;
        this.e = e;
    }

    public MessageException(ApiResponseCode errEnum, String msg, Throwable e) {
        super(msg, e);
        this.code = errEnum.getCode();
        this.msg = msg;
        this.e = e;
    }

    public String getCode() {
        return this.code;
    }

    public String getMsg() {
        return this.msg;
    }

    public Throwable getE() {
        return this.e;
    }
}
